12. Merge Sort Practice

Merge Sort Practice

Question:

Sorting is pretty tedious—take a break and check out this comic inspired by merge sort.

You can learn more about merge sort, as well as see many more visualizations, in the online Algorithms textbook . This book is often nice for a more in-depth analysis of topics, but beware—all of the examples are in Java! For merge sort, it's particularly worth reading up on top-down and bottom-up merge sort.

Start Quiz:

Solution:

Depending on the way you design your merge sort, you could get a few different solutions, but this was the answer:

[21, 4, 1, 3, 9, 20, 25] (Original Array)
[21, 1, 4, 3, 9, 20, 25] (1)
[1, 4, 21, 3, 9, 20, 25] (2)
[1, 3, 4, 9, 20, 21, 25] (3)